<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        #box{
            width: 200px;
            height: 200px;
            background: pink;
        }
    </style>
</head>
<body>
    <!--  
        1. 鼠标事件
            onclick         单击
            ondblclick      双击
            oncontextmenu   右击
            onmouseover     划入
            onmouseout      划出
            onmousedown     按下
            onmouseup       松开
            onmousemove     移动
    -->
    <div id="box"></div>

    <script>
        var box = document.getElementById('box')

        // 单击
        // box.onclick = function(){
        //     this.innerHTML = '单击';
        // }

        // 双击
        box.ondblclick = function(){
            this.innerHTML = '双击';
        }

        // 右击
        box.oncontextmenu = function(){
            this.innerHTML = '右击';
        }

        // 划入
        box.onmouseover = function(){
            this.innerHTML = '划入';
        }

        // 划出
        box.onmouseout = function(){
            this.innerHTML = '划出';
        }

        // 按下
        box.onmousedown = function(){
            this.innerHTML = '按下';
        }

        // 松开
        box.onmouseup = function(){
            this.innerHTML = '松开';
        }

        // 移动
        box.onmousemove = function(){
            // 随机 0~255 
            var r = Math.round(Math.random() * 255);
            var g = Math.round(Math.random() * 255);
            var b = Math.round(Math.random() * 255);
            this.style.backgroundColor = `rgb(${r} , ${g}, ${b})`;
        }
    </script>




</body>
</html>